<template>
  <div class="mt--20 purchase-detail">
    <div class="detail-section">
      <el-row type="flex" align="middle">
        <el-col :span="12">流程基础信息</el-col>
      </el-row>
      <el-divider></el-divider>
      <el-form class="detail-form" label-width="120px" label-suffix=":">
        <el-row>
          <el-col :span="8">
            <el-form-item label="流程类型">
              <span class="detail-value">{{baseInfo.processName  || ''}}</span>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="发起人">
              <span class="detail-value">{{baseInfo.initiator || ''}}</span>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="流程节点">
              <span class="detail-value">{{baseInfo.auditUserName || ''}}</span>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="关联单号">
              <span class="detail-value">{{baseInfo.auditNum || ''}}</span>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="发起时间">
              <span class="detail-value">{{baseInfo.auditCreateTime || ''}}</span>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="流程状态">
              <span class="detail-value">{{baseInfo.status || ''}}</span>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <div class="detail-section">
      <el-row type="flex" align="middle">
        <el-col :span="12">车辆进销存基础信息</el-col>
      </el-row>
      <el-divider></el-divider>
      <el-form class="detail-form" label-width="120px" label-suffix=":">
        <el-row>
          <el-col :span="6">
            <el-form-item label="入库门店">
              <span class="detail-value">{{detail.inStoreName  || ''}}</span>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="出库门店">
              <span class="detail-value">{{detail.outStoreName || ''}}</span>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="车架号">
              <span class="detail-value">{{detail.vin || ""}}</span>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="发动机号">
              <span class="detail-value">{{baseInfo.engineModel || ''}}</span>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            <el-form-item label="品牌">
              <span class="detail-value">{{detail.carBrandName || ''}}</span>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="车系">
              <span class="detail-value">{{detail.seriesName || ''}}</span>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="车型">
              <span class="detail-value">{{detail.modelName || ''}}</span>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            <el-form-item label="车身颜色">
              <span class="detail-value">{{detail.roofColor || ''}}</span>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="内饰颜色">
              <span class="detail-value">{{detail.inColor || ''}}</span>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="车顶颜色">
              <span class="detail-value">{{detail.outColor || ''}}</span>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="配件及价格明细">
              <span class="detail-value">{{detail.addPartsDetail || ''}}</span>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            <el-form-item label="前装及价格明细">
              <span class="detail-value">{{detail.qzDetail || ''}}</span>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="采购单价">
              <span class="detail-value">{{detail.purchasePrice || ''}}</span>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="总金额">
              <span class="detail-value">{{detail.amount || ''}}</span>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>
  </div>
</template>

<script>
import { auditDetail } from '@/api/pre-sale/taskCenter/auditTask'

export default {
  props: {
    taskId: {
      type: Number,
      default: 0
    }
  },
  data() {
    return {
      baseInfo: {},
      detail: {}
    }
  },
  methods: {
    getDetail() {
      if (this.taskId === 0) {
        return
      }
      auditDetail(this.taskId).then(res => {
        const { auditCreateTime, auditNum, auditUserName, initiator, processName, status, carList = [] } = res.data
        this.baseInfo = {
          auditCreateTime,
          auditNum,
          auditUserName,
          initiator,
          processName,
          status
        }
        this.detail = carList[0] || {}
      })
    }
  },
  mounted() {
    this.getDetail()
  }
}
</script>

<style>

</style>
